﻿#region License

// // -------------------------------------------------------------------------------------
// // This information refers to Reference.cs
// // 
// // Copyright 2012 ELEN7046 Group 2
// // 
// // Last Modified on: 2012-06-10
// // 
// // Contributors:
// // 
// // Amith Sewnarain
// // Elmar Vosloo
// // Jason Thorne
// // Satish Jewan
// // 
// // Wits University 
// // School of Electrical & Information Engineering
// // Software Engineering Tools and Techniques
// // 
// // -------------------------------------------------------------------------------------
// // 
// // This file (Reference.cs) is part of the DishDash Event Visualization System.
// // 
// // DishDash is free software: you can redistribute it and/or modify
// // it under the terms of the GNU General Public License as published by
// // the Free Software Foundation, either version 3 of the License, or
// // (at your option) any later version.
// // 
// // DishDash is distributed in the hope that it will be useful,
// // but WITHOUT ANY WARRANTY; without even the implied warranty of
// // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// // GNU General Public License for more details.
// // 
// // You should have received a copy of the GNU General Public License
// // along with DishDash.  
// // If not, see <http://www.gnu.org/licenses/>.
// // -------------------------------------------------------------------------------------

#endregion

namespace ProfilingApp.Handlers.SecurityService
{
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(Namespace = "http://security.profilingapp",
        ConfigurationName = "SecurityService.SecurityProvider")]
    public interface SecurityProvider
    {
        // CODEGEN: Generating message contract since element name user from namespace http://security.profilingapp is not marked nillable
        [System.ServiceModel.OperationContractAttribute(Action = "", ReplyAction = "*")]
        ProfilingApp.Handlers.SecurityService.AuthenticateResponse Authenticate(
            ProfilingApp.Handlers.SecurityService.AuthenticateRequest request);
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]
    public partial class AuthenticateRequest
    {
        [System.ServiceModel.MessageBodyMemberAttribute(Name = "Authenticate",
            Namespace = "http://security.profilingapp", Order = 0)] public
            ProfilingApp.Handlers.SecurityService.AuthenticateRequestBody Body;

        public AuthenticateRequest()
        {
        }

        public AuthenticateRequest(ProfilingApp.Handlers.SecurityService.AuthenticateRequestBody Body)
        {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace = "http://security.profilingapp")]
    public partial class AuthenticateRequestBody
    {
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 1)] public string password;
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)] public string user;

        public AuthenticateRequestBody()
        {
        }

        public AuthenticateRequestBody(string user, string password)
        {
            this.user = user;
            this.password = password;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]
    public partial class AuthenticateResponse
    {
        [System.ServiceModel.MessageBodyMemberAttribute(Name = "AuthenticateResponse",
            Namespace = "http://security.profilingapp", Order = 0)] public
            ProfilingApp.Handlers.SecurityService.AuthenticateResponseBody Body;

        public AuthenticateResponse()
        {
        }

        public AuthenticateResponse(ProfilingApp.Handlers.SecurityService.AuthenticateResponseBody Body)
        {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace = "http://security.profilingapp")]
    public partial class AuthenticateResponseBody
    {
        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)] public bool AuthenticateReturn;

        public AuthenticateResponseBody()
        {
        }

        public AuthenticateResponseBody(bool AuthenticateReturn)
        {
            this.AuthenticateReturn = AuthenticateReturn;
        }
    }

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface SecurityProviderChannel : ProfilingApp.Handlers.SecurityService.SecurityProvider,
                                               System.ServiceModel.IClientChannel
    {
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class SecurityProviderClient :
        System.ServiceModel.ClientBase<ProfilingApp.Handlers.SecurityService.SecurityProvider>,
        ProfilingApp.Handlers.SecurityService.SecurityProvider
    {
        public SecurityProviderClient()
        {
        }

        public SecurityProviderClient(string endpointConfigurationName) :
            base(endpointConfigurationName)
        {
        }

        public SecurityProviderClient(string endpointConfigurationName, string remoteAddress) :
            base(endpointConfigurationName, remoteAddress)
        {
        }

        public SecurityProviderClient(string endpointConfigurationName,
                                      System.ServiceModel.EndpointAddress remoteAddress) :
                                          base(endpointConfigurationName, remoteAddress)
        {
        }

        public SecurityProviderClient(System.ServiceModel.Channels.Binding binding,
                                      System.ServiceModel.EndpointAddress remoteAddress) :
                                          base(binding, remoteAddress)
        {
        }

        #region SecurityProvider Members

        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        ProfilingApp.Handlers.SecurityService.AuthenticateResponse
        ProfilingApp.Handlers.SecurityService.SecurityProvider.Authenticate(
            ProfilingApp.Handlers.SecurityService.AuthenticateRequest request)
        {
            return base.Channel.Authenticate(request);
        }

        #endregion

        public bool Authenticate(string user, string password)
        {
            var inValue = new ProfilingApp.Handlers.SecurityService.AuthenticateRequest();
            inValue.Body = new ProfilingApp.Handlers.SecurityService.AuthenticateRequestBody();
            inValue.Body.user = user;
            inValue.Body.password = password;
            ProfilingApp.Handlers.SecurityService.AuthenticateResponse retVal =
                ((ProfilingApp.Handlers.SecurityService.SecurityProvider) (this)).Authenticate(inValue);
            return retVal.Body.AuthenticateReturn;
        }
    }
}